package org.com.coolfish.common.database.repository;

import java.util.List;

import org.com.coolfish.common.database.entity.KuyuAgent;
import org.com.coolfish.common.database.entity.KuyuAgentAccount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface KuyuAgentRepository extends JpaRepository<KuyuAgent, Integer> {
	
	@Modifying
    @Query("UPDATE KuyuAgent a SET a.amount=:amount WHERE a.id =:aid")
	void updateAmount(@Param("amount")Double amount,@Param("aid")Integer aid);
	
	@Query("select new KuyuAgent(a.uid,a.per,a.amount) from KuyuAgent a inner join KuyuPackagePrice pp on a.id=pp.aid where pp.aid =:aid")
	KuyuAgent queryAmount(@Param("aid")Integer aid);
	
	
}
